package com.swak.hazelcast;

import com.hazelcast.config.Config;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
import com.hazelcast.topic.ITopic;

public class HazelcastPeerA {

	public static void main(String[] args) {
		Config config = new Config("PeerA");
		HazelcastInstance hazelcast = HazelcastInstanceFactory.newHazelcastInstance(config);
		ITopic<String> topic = hazelcast.getTopic("Topic");
		topic.addMessageListener((message) ->{
			System.out.println("收到消息：" + message);
		});
	}
}
